<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>统计管理</title>
	<meta name="decorator" content="default"/>
	<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
		
		/**
		** 查明细
		**/
		function queryDetail(awardType,awardName){
			$('#linkStartTime').val($('#startTime').val());
			$('#awardType').val(awardType);
			$('#name').val(awardName);
			queryDetailForm.submit();
		}
		
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/wechat/statics/statUsed/">按奖品名称统计</a></li>
		<li><a href="${ctx}/wechat/statics/stat/">按奖品类型统计</a></li>
		<li><a href="${ctx}/wechat/statics/statCategory/">按抽奖类型统计</a></li>
		<li class="active"><a href="${ctx}/wechat/statics/statTerminalUsed/">按核销单位统计</a></li>
	</ul>
	<form id="searchForm"   action="${ctx}/wechat/statics/statTerminalUsed/" method="post" class="breadcrumb form-search">
		<label>开始时间：</label>
					<input id="startTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="${startTime }"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
						
		<label>结束时间 ：</label>
					<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="${endTime }"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
						
		&nbsp;&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form>
	<tags:message content="${message}"/>
	<form  name="queryDetailForm" action="${ctx }/wechat/statics/detail/" method="post">
		<input type="hidden" name="awardType" id="awardType" value="${awardType }"/>
		<input type="hidden"  name="name" id="name" value="${name }"/>
		<input type="hidden"  name="status" id="status" value="1"/>
		<input type="hidden"  name="startTime" id="linkStartTime" value="${startTime }"/>
		<input type="hidden"  name="endTime" id="linkEndTime" value="${endTime }"/>
	</form>
 	
	<table id="contentTable" class="table table-striped table-bordered ">
		<thead><tr>
		<shiro:hasPermission name="sys:user:edit">
			<th>所属商家</th></shiro:hasPermission>
			<th>奖品类型</th>
			<th>奖品名称</th>
			<th>核销单位</th>
			<th>核销数量</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${statics}" var="stat">
			<tr>
				<shiro:hasPermission name="sys:user:edit"><td>${user.name}</td></shiro:hasPermission>
				<td>${stat.award_type}</td>
				<td>${stat.NAME}</td>
				<td>${stat.terminal_remarks}</td>
				<c:set var="totalCount" value="${totalCount + stat.cnt}"></c:set>
				<td><a href="javascript:queryDetail('${stat.award_type}','${stat.NAME}');"> ${stat.cnt }</a>	</td>
			</tr>
		</c:forEach>
			<tr>
				<shiro:hasPermission name="sys:user:edit"><td>${user.name}</td></shiro:hasPermission>
				<td colspan="3"><h5 style="color:red" id="totalCount">合计</h5></td>
				<td><h5 style="color:red" id="totalCount">${totalCount }</h5>	</td>
			</tr>
		</tbody>
	</table>
</body>
</html>
